package com.shumm.controller;

import com.shumm.common.Result;
import com.shumm.po.ClassicFormulaComposition;
import com.shumm.service.ClassicFormulaCompositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: and
 * @Description:
 * @create 2023/11/22 14:30
 */
@RequestMapping("/cfc")
@RestController
public class ClassicFormulaCompositionController {

    @Autowired
    private ClassicFormulaCompositionService service;


    @PostMapping("/selectTbByCf")
    private Result selectTbByCf(@RequestParam int id) {
            return service.selectTbByCf(id);
    }

    @PostMapping("/add")
    private Result add(@RequestBody ClassicFormulaComposition classicFormulaComposition){
        return service.add(classicFormulaComposition);
    }


    @PostMapping("/delete")
    public Result delete(@RequestParam("id") int id){
        System.out.println(id);
        return service.delete(id);
    }


    @PostMapping("/update")
    public Result update(@RequestBody ClassicFormulaComposition classicFormulaComposition){
        return service.update(classicFormulaComposition);
    }

    @PostMapping("/selectById")
    public Result selectById(@RequestParam int id) {
        return  service.selectById(id);
    }

    @PostMapping("/selectAll")
    public Result selectAll() {
        return service.selectAll();
    }

    @PostMapping("/selectByCfId")
    public void selectByCfId(@RequestParam int cfId){
        Result result = service.selectByCfId(cfId);
    }

    @GetMapping("/selectByTcmId")
    public Result selectByTcmId(@RequestParam int tmcId){
        return service.selectByTcmId(tmcId);
    }

    @PostMapping("/selectTcm")
    public Result selectTcm(){
        return service.selectTcm();
    }
}
